package com.epfresh.bean;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by wzh on 16-8-29.
 */
public class CartListCopy {

    private List<MarketCart> wholeSaleMarketOrderList;

    private String wallets;
    private String productExpressFee;

    private List<PaymentModes> payTypeList;
    private List<CouponEntity> couponList;
    private List<CouponEntity> couponBestList;
    private List<CouponEntity> couponSelectList;
    private List<DeliveryDate> deliveryDateList;

    private List<DeliveryDateNew> normalDeliveryDate;
    private List<DeliveryDateNew> expressDeliveryDate;

    private Integer couponRemainQty = 0;//剩余使用优惠券的数量
    private boolean bulkIsUsedCoupon = false;//散货是否使用优惠券；false：不可用；true：可用
    public List<DeliveryDate> getDeliveryDateList() {
        return deliveryDateList;
    }

    public List<DeliveryDateNew> getNormalDeliveryDate() {
        return normalDeliveryDate;
    }

    public void setNormalDeliveryDate(List<DeliveryDateNew> normalDeliveryDate) {
        this.normalDeliveryDate = normalDeliveryDate;
    }

    public List<DeliveryDateNew> getExpressDeliveryDate() {
        return expressDeliveryDate;
    }

    public void setExpressDeliveryDate(List<DeliveryDateNew> expressDeliveryDate) {
        this.expressDeliveryDate = expressDeliveryDate;
    }

    public Integer getCouponRemainQty() {
        return couponRemainQty;
    }

    public void setCouponRemainQty(Integer couponRemainQty) {
        this.couponRemainQty = couponRemainQty;
    }

    public boolean isBulkIsUsedCoupon() {
        return bulkIsUsedCoupon;
    }

    public void setBulkIsUsedCoupon(boolean bulkIsUsedCoupon) {
        this.bulkIsUsedCoupon = bulkIsUsedCoupon;
    }

    public void setDeliveryDateList(List<DeliveryDate> deliveryDateList) {
        this.deliveryDateList = deliveryDateList;
    }

    public List<MarketCart> getWholeSaleMarketOrderList() {
        return wholeSaleMarketOrderList;
    }

    public void setWholeSaleMarketOrderList(List<MarketCart> wholeSaleMarketOrderList) {
        this.wholeSaleMarketOrderList = wholeSaleMarketOrderList;
    }

    public float getWallets() {
        float f = 0f;
        if (wallets != null && !"null".equals(wallets)) {
            f = Float.valueOf(wallets);
        }
        return f;
    }

    public void setWallets(float wallets) {
        this.wallets = wallets + "";
    }

    public String getProductExpressFee() {
        return productExpressFee;
    }

    public void setProductExpressFee(String productExpressFee) {
        this.productExpressFee = productExpressFee;
    }

    public List<PaymentModes> getPayTypeList() {
        return payTypeList;
    }

    public void setPayTypeList(List<PaymentModes> payTypeList) {
        this.payTypeList = payTypeList;
    }

    public List<CouponEntity> getCouponList() {
        return couponList;
    }

    public void setCouponList(List<CouponEntity> couponList) {
        this.couponList = couponList;
    }
    public void setSelectCouponList(List<CouponEntity> couponList) {
        this.couponSelectList = couponList;
    }

    public List<String> getCoupons() {
        List<String> list = new ArrayList<>();
        if (couponSelectList != null) {
            for (int i = 0; i < couponSelectList.size(); i++) {
                if (couponSelectList.get(i).getSelected()) {
                    list.add(couponSelectList.get(i).getId());
                }
            }
        }
        return list;
    }
    public List<CouponEntity> getSelectCoupons() {
        if (couponSelectList == null || couponSelectList.size() == 0) {
            List<CouponEntity> list = new ArrayList<>();
            if (couponList != null) {
                for (int i = 0; i < couponList.size(); i++) {
                    if (couponList.get(i).getSelected()) {
                        list.add(couponList.get(i));
                    }
                }
            }
            return list;
        }
        return couponSelectList;
    }

    public float getCouponsPrice() {
        float p = 0;
        if (couponList != null) {
            for (int i = 0; i < couponList.size(); i++) {
                if (couponList.get(i).getSelected()) {
                    float minusPriceFloat = couponList.get(i).getMinusPriceFloat();
                    p += minusPriceFloat;
                }
            }
        }
        return ((int) (p * 100)) == 0 ? 0 : -p;
    }

    public List<CouponEntity> getBestCoupons() {
        return couponBestList;
    }

    public void initBestCoupons() {
        if (couponList != null){
            for (int i=0;i<couponList.size();i++){
                if (couponBestList==null){
                    couponBestList = new ArrayList<>();
                }
                couponBestList.add(couponList.get(i));
            }
        }
    }
    public void initSelectCoupons() {
        setSelectCouponList(getSelectCoupons());
    }
}
